<?php
    /**
     *	RelatedItem class
     *	Stores a related item component and the mapping information.
     *	@author	Simon Copsey <simon.copsey@gmail.com>
     *	@version 0.1
     *	@package framework
     */
    class RelatedItem {
        private $localColumnName;
        private $component;
        private $foreignColumnName;
        
        /**
        * Create a new RelatedItem with a given Component, local column name and foreign column name.
        * Used by a component to store relations to other components via the local and foreign column
        * names - the values of these columns must match for a relation to be deemed present.
        *
        * @param String $aLocalColumnName name of relational column within local component
        * @param Component $aRelatedItem the (foreign) component
        * @param String $aForeignColumnName name of relational column within foreign component
        * @access public
        */        
	public function __construct($aLocalColumnName, $aComponent, $aForeignColumnName) {
	    $this->localColumnName = $aLocalColumnName;
	    $this->component = $aComponent;
	    $this->foreignColumnName = $aForeignColumnName;
	}
        
        /**
        * Returns name of relational column within local component.
        *
        * @return String column name
        * @access public
        */
        public function getLocalColumnName() {
            return $this->localColumnName;
        }
        
        /**
        * Returns (foreign) component.
        *
        * @return Component component
        * @access public
        */
        public function getComponent() {
            return $this->component;
        }
        
        /**
        * Returns name of relational column within foreign component.
        *
        * @return String column name
        * @access public
        */
        public function getForeignColumnName() {
            return $this->foreignColumnName;
        }
    }
?>